<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no" />
<title>Document</title>
<style type="text/css">
#box {
	width: 100px;
	height: 100px;
	border: 1px solid #000;
	padding: 100px;
	-webkit-perspective: 300px;
	perspective: 300px;
}	
#div  {
	width: 100px;
	height: 100px;
	color: #fff;
	font-size: 50px;
	line-height: 100px;
	text-align: center;
	position: relative;
	-webkit-transform-style: preserve-3d;
	transform-style: preserve-3d;
	-webkit-transform-origin: center center -50px;
	transform-origin: center center -50px;
	transition: 5s;
}
#div span {
	position: absolute;
	left: 0;
	top: 0;
	width: 100px;
	height: 100px;
	-webkit-transform-origin: center center -50px;
	transform-origin: center center -50px;
	transition: 5s;
}
#div span:nth-of-type(1){
	background: red;
	-webkit-transform: rotateY(0deg);
	transform: rotateY(0deg);
}
#div span:nth-of-type(2){
	background: yellow;
	-webkit-transform: rotateY(90deg);
	transform: rotateY(90deg);
}
#div span:nth-of-type(3){
	background: blue;
	-webkit-transform: rotateY(180deg);
	transform: rotateY(180deg);
}
#div span:nth-of-type(4){
	background: green;
	-webkit-transform: rotateY(270deg);
	transform: rotateY(270deg);
}
#div span:nth-of-type(5){
	background: pink;
	-webkit-transform: rotateX(90deg);
	transform: rotateX(90deg);
}
#div span:nth-of-type(6){
	background: #000;
	-webkit-transform: rotateX(-90deg);
	transform: rotateX(-90deg);
}
/*
transform-origin 变换原点 center center;
	关键字: top bottom center left right;
	具体的长度单位(em,rem,px...)

会受到原点影响的变换有：rotate、skew、scale	

*/
</style>
<script type="text/javascript">
window.onload = function(){
	var div = document.querySelector('#div');
	div.style.WebkitTransform = div.style.transform = "rotateX(360deg)";
};
</script>
</head>
<body>
	<div id="box">
		<div id="div">
			<span>前</span>
			<span>右</span>
			<span>后</span>
			<span>左</span>
			<span>上</span>
			<span>下</span>
		</div>
	</div>
</body>
</html>